package com.ruoyi.quality.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.quality.domain.InspectionBasis;
import com.ruoyi.quality.mapper.InspectionBasisMapper;
import com.ruoyi.quality.service.IInspectionBasisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 检测检验依据Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-17
 */
@Service
public class InspectionBasisServiceImpl implements IInspectionBasisService
{
    @Autowired(required = false)
    private InspectionBasisMapper inspectionBasisMapper;

    /**
     * 查询检测检验依据
     * 
     * @param id 检测检验依据主键
     * @return 检测检验依据
     */
    @Override
    public InspectionBasis selectInspectionBasisById(String id)
    {
        return inspectionBasisMapper.selectInspectionBasisById(id);
    }

    /**
     * 查询检测检验依据列表
     * 
     * @param inspectionBasis 检测检验依据
     * @return 检测检验依据
     */
    @Override
    public List<InspectionBasis> selectInspectionBasisList(InspectionBasis inspectionBasis)
    {
        return inspectionBasisMapper.selectInspectionBasisList(inspectionBasis);
    }

    /**
     * 新增检测检验依据
     * 
     * @param inspectionBasis 检测检验依据
     * @return 结果
     */
    @Override
    public int insertInspectionBasis(InspectionBasis inspectionBasis)
    {
        inspectionBasis.setCreateTime(DateUtils.getNowDate());
        inspectionBasis.setId(IdUtils.fastSimpleUUID());
        inspectionBasis.setState("1");
        return inspectionBasisMapper.insertInspectionBasis(inspectionBasis);
    }

    /**
     * 修改检测检验依据
     * 
     * @param inspectionBasis 检测检验依据
     * @return 结果
     */
    @Override
    public int updateInspectionBasis(InspectionBasis inspectionBasis)
    {
        inspectionBasis.setUpdateTime(DateUtils.getNowDate());
        return inspectionBasisMapper.updateInspectionBasis(inspectionBasis);
    }

    /**
     * 批量删除检测检验依据
     * 
     * @param ids 需要删除的检测检验依据主键
     * @return 结果
     */
    @Override
    public int deleteInspectionBasisByIds(String[] ids)
    {
        return inspectionBasisMapper.deleteInspectionBasisByIds(ids);
    }

    /**
     * 删除检测检验依据信息
     * 
     * @param id 检测检验依据主键
     * @return 结果
     */
    @Override
    public int deleteInspectionBasisById(String id)
    {
        return inspectionBasisMapper.deleteInspectionBasisById(id);
    }

    @Override
    public List<String> selectInspectionBasisByEquType(String equType) {
        return inspectionBasisMapper.selectInspectionBasisByEquType(equType);
    }
}
